import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'home',
    component: HomeView
  },
  {
    path: '/about',
    name: 'home',
    component: ()=>import("../views/AboutView.vue")
  },
  {
    path: '/register',
    name: 'register',
    component:  () => import(/* webpackChunkName: "about" */ '../views/register.vue'),
  },
  {
    path: '/',
    name: 'index',
    redirect:"/blog",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/index.vue'),
    children:[
      {
        path: '/blog',
        name: 'blog',
        component:  () => import(/* webpackChunkName: "about" */ '../views/blog.vue'),
      },
      {
        path: '/type',
        name: 'type',
        component:  () => import(/* webpackChunkName: "about" */ '../views/type.vue'),
      },
      {
        path: '/member',
        name: 'member',
        component:  () => import(/* webpackChunkName: "about" */ '../views/member.vue'),
      },
      {
        path: '/project',
        name: 'project',
        component:  () => import(/* webpackChunkName: "about" */ '../views/project.vue'),
      },
      {
        path: '/addArticle',
        name: 'addArticle',
        component:  () => import(/* webpackChunkName: "about" */ '../views/addArticle.vue'),
      },
      {
        path: '/detail',
        name: 'detail',
        component:  () => import(/* webpackChunkName: "about" */ '../views/detail.vue'),
      },
      {
        path: '/addProduct',
        name: 'addProduct',
        component:  () => import(/* webpackChunkName: "about" */ '../views/addProduct.vue'),
      },
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
